# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
#   include emiconfig::vobox
class emiconfig::vobox {
  include 'emiconfig::ui'
  include 'emiconfig::vomses'
  $vobox_pkgs=[
      "wlcg-vobox",
  ]
  package{ $vobox_pkgs:
    ensure  => "installed",
    require => Yumrepo['site'],
  }
  file {"/root/users.conf":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/alice_users.conf",
  } 
  file {"/root/groups.conf":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/alice_groups.conf",
  } 
  file {"/root/site-info.conf":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/alice_siteinfo.conf",
  }
  # for condor

  $condor_pkg = [
    "condor",
    "condor-classads",
    "condor-kbdd",
    "condor-procd",
    "condor-externals",
    "python3-condor",
    "python3-scitokens",
  ]

  yumrepo { "condor":
    baseurl => "http://${mirrorserver}/yum/condor/repo/23.0/el${facts['os']['release']['major']}/x86_64/release",
    descr => "condor",
    enabled => 1,
    gpgcheck => 0,
    priority => 20,
    before   => Yumrepo['site'],
  }->
  package { $condor_pkg:
              ensure  => installed,
              require => Yumrepo['site'],
  }->
  file { "/etc/condor/config.d/00-minicondor":
    ensure     => absent,
  }->
  file { "/etc/condor/config.d/99-minicondor.vobox":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/vobox-99-minicondor.vobox",
  } ->
  file { "/etc/condor/config.d/99-alice-vobox.conf":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/vobox-99-alice-vobox.conf",
  } 
  service { 'condor':
    ensure     => 'running',
    enable     => true,
    hasrestart => true,
    hasstatus  => true,
  }
}
